import React, { Component } from 'react'
import AddWarehouse from './AddWarehouse';
import SelectWarehouse from './SelectWarehouse';
import OpenBush from './OpenBush';

import AddHeard from './AddWarehouseFile/AddHeard';
import AddMianData from './AddWarehouseFile/AddMianData';

import WarehouseDetail from './WarehouseDetail/WarehouseDetail';

export default class WarehouseLayout extends Component {
    chanceAction = (action:any,data:any) => {
       this.setState({ key: action,todos:data });
    }
  
    state = {
        action: new Map([
            ['main',
            <div>
                <AddWarehouse chanceAction={this.chanceAction}  />
                <SelectWarehouse />
                <OpenBush chanceAction={this.chanceAction}/>
            </div>],
            ['new',
            <div>
                <AddHeard chanceAction={this.chanceAction}/>
                <AddMianData />
            </div>],
            ['detail',
            <div>
                <WarehouseDetail chanceAction={this.chanceAction}/>
            </div>]
        ]),
        key: "main",
        todos: {}
    } 
    
    render() {
        const { action, key } = this.state;
        return (
            <div style={{backgroundColor:'white'}}>
               {action.get(key)}
            </div>
        )
    }
}
